package com.xm.zhEnHelper.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xm.zhEnHelper.domain.ZhToEn;
import com.xm.zhEnHelper.service.ZhToEnService;
import com.xm.zhEnHelper.mapper.ZhToEnMapper;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【zh_to_en(中英文对应)】的数据库操作Service实现
* @createDate 2025-08-12 17:24:52
*/
@Service
public class ZhToEnServiceImpl extends ServiceImpl<ZhToEnMapper, ZhToEn>
    implements ZhToEnService{

    @Override
    public boolean zhToEnExists(String zhText) {
        return super.lambdaQuery().eq(ZhToEn::getZhText, zhText).exists();
    }

    @Override
    public String getEnText(String zhText) {
        ZhToEn one = this.lambdaQuery().eq(ZhToEn::getZhText, zhText).one();
        if (null == one){
            return null;
        }
        return one.getEnText();
    }

    @Override
    public void saveZhToEn(String zhText,String enText) {
        this.save(new ZhToEn() {{
            setZhText(zhText);
            setEnText(enText);
        }});
    }
}




